﻿using System.Collections.Generic;

namespace Gamemaster.Console
{
    public static class Commands
    {
        public static IEnumerable<ICommand> Assemble(params string[] args)
        {
            List<ICommand> commands = new List<ICommand>();

            if (args.Length > 0)
            {
                string command = args[0].ToLower();
                switch (command)
                {
                    case "roll":
                        commands.Add(new RollCommand(args) { Out = System.Console.Out });
                        break;
                    case "name":
                    case "names":
                        commands.Add(new NameCommand(args) { Out = System.Console.Out });
                        break;
                    case "npc":
                        commands.Add(new NpcCommand(args) { Out = System.Console.Out });
                        break;
                }
            }

            if (commands.Count == 0)
            {
                commands.Add(new IndexCommand(args) { Out = System.Console.Out });
            }

            return commands;
        }
    }
}
